package dog;

public class Dog {
    private String name;
    private String color;
    private int age;
    private int weight;

    private static int num = 0;

    {
        Dog.num++;
    }

    static {
        
    }

    public static int getNum() {
        return Dog.num;
    }

    public int getAge() {
        return this.age;
    }
    public int getWeight() {
        return this.weight;
    }
    public String getName() {
        return this.name;
    }

    public String getColor() {
        return this.color;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }
    public void setName(String name) {
        this.name = name;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Dog(String name, String color, int age, int weight) {
        this.name = name;
        this.color = color;
        this.age = age;
        this.weight = weight;
    }
    public void wolf() {
        System.out.println(this.name + "狗叫");
    }

    public void eat() {
        System.out.println(this.name + "吃东西");
    }

    public void meet(Dog dog2) {
        if(this.color == dog2.color) {
            this.friend(dog2);
        }else {
            this.fight(dog2);
        }
    }

    private void friend(Dog dog2) {
        System.out.println(this.name + "与" + dog2.name + "相处得很好");
        if(this.weight > dog2.weight) {
            System.out.println(dog2.name + "认" + this.name + "做老大");
        }else if(this.weight < dog2.weight) {
            System.out.println(this.name + "认" + dog2.name + "做老大");
        }else {
            System.out.println(this.name + "与" + dog2.name + "做了兄弟");
        }
    }

    private void fight(Dog dog2) {
        System.out.println(this.name + "与" + dog2.name + "打架了");
        if(this.weight > dog2.weight) {
            System.out.println(dog2.name + "被" + this.name + "打倒了");
        }else if(this.weight < dog2.weight) {
            System.out.println(this.name + "被" + dog2.name + "打倒了");
        }else {
            System.out.println(this.name + "与" + dog2.name + "不相上下");
        }
    }

    public static void main(String[] args) {
        System.out.println("test");
    }
}
